import request from '@/common/request.js'
import {AuditResourcesForm, NewsForm, NewsUpdateForm} from "./type";

//资源审核
const auditResource = (param) => {
    const url = '8185/academicLearning/audit';
    return request.globalRequest(url, 'POST', param, 1)
};

//发布新闻
const publishNews = (param) => {
    const url = '8185/news';
    return request.globalRequest(url, 'POST', param, 1)
};

//修改新闻信息
const updateNews = (param) => {
    const url = '8185/news';
    return request.globalRequest(url, 'PUT', param, 1)
};

//删除新闻信息
const deleteNews = (param) => {
    const url = '8185/news';
    return request.globalRequest(url, 'DELETE', param, 1)
};

//获取所有报修列表
const getRepairList = () => {
    const url = '8184/campusRepair/list';
    return request.globalRequest(url, 'GET', {}, 1)
}

//取消报修
const cancelRepair = (id) => {
    const url = `8184/campusRepair/cancel/${id}`;
    return request.globalRequest(url, 'GET', {}, 1)
};

//报修完成
const acceptRepair = (id) => {
    const url = `8184/campusRepair/accept/${id}`;
    return request.globalRequest(url, 'GET', {}, 1)
};

//删除课程
const deleteCourse = (id) => {
    const url = `8183/course/delete-course/${id}`
    return request.globalRequest(url, 'DELETE', {}, 1)
}
//排课
const arrangeCourse = (data) => {
    const url = '8183/courseSchedule/arrange-course'
    return request.globalRequest(url, 'POST', data, 1)
}
//修改课程
const updateCourse = (data) => {
    const url = '8183/course/update-course'
    return request.globalRequest(url, 'POST', data, 1)
}
//新增课程
const addCourse = (data) => {
    const url = '8183/course/add-course'
    return request.globalRequest(url, 'POST', data, 1)
}

//新增课程
const teacherList = () => {
    const url = '8181/auth/list'
    return request.globalRequest(url, 'GET', {}, 1)
}

export default {
    auditResource,
    publishNews, updateNews, deleteNews,
    cancelRepair, acceptRepair, getRepairList,
	deleteCourse, arrangeCourse,
	updateCourse, addCourse,
    teacherList
}